package com.tools.cloud.api.util;

import cn.hutool.core.util.RuntimeUtil;

import java.io.InputStream;
import java.util.List;

public class ServerUtils {
    public static void main(String[] args) {
        Process exec = RuntimeUtil.exec("ping www.baidu.com -t");
        while (exec.isAlive()) {
            InputStream inputStream =
                    exec.getInputStream();

            byte[] b = new byte[512];
            int len = 0;
            try {
                while ((len = inputStream.read(b)) != -1) {
                    System.out.print(new String(b, 0, len, "GBK"));
                }

            } catch (Exception e) {
                e.printStackTrace();
            }

        }
    }
}
